loadList();
async function loadList() {
  let pagesize = 15;
  let pagenum = 0;
  let uid = localStorage.getItem("uid");
  let params = { pagenum, pagesize, uid };
  //获取后，发起请求
  let { data } = await axios.get(productListAPI, { params });
  // console.log(data);
  //处理数据 让其显示

  productArr = data.data;
  // console.log(productArr);
  let resArr = productArr.map(
    (pObj) => `
        <li class="goods1">
            <a href="detail.html?pid=${pObj.pid}">
            <img src="${pObj.pimg}">
            </a>
        </li>
        `
  );
  // console.log(resArr);
  let a = resArr.slice(9, 15);
  let goodss = document.querySelector(".goodss");
  goodss.innerHTML = a.join("");

  let b = resArr.slice(6, 9);
  let conss = document.querySelector(".conss");
  conss.innerHTML = b.join("");

  let c = resArr.slice(0, 6);
  let mess = document.querySelector(".mess");
  mess.innerHTML = c.join("");
}

//下拉菜单
let Sub = document.querySelector(".sub");
console.log(Sub);
let subA = Sub.querySelectorAll("a");
console.log(subA);
let Span = Sub.querySelectorAll("span");
console.log(Span);

let wssUl = document.querySelector(".wss");
console.log(wssUl);
let wbbUl = document.querySelector(".wbb");
console.log(wbbUl);

Span[0].onclick = function (evt) {
  wssUl.style.display = "block";
  console.log("Span click");
  evt.stopPropagation();
};

Span[1].onclick = function (evt) {
  wbbUl.style.display = "block";
  console.log("Span click");
  evt.stopPropagation();
};
document.onclick = function () {
  wssUl.style.display = "none";
  wbbUl.style.display = "none";
  console.log("doc click");
};
